import static org.junit.Assert.*;
import models.Event;
import models.User;
import models.EventUser;

import org.junit.Test;
import java.util.*;

import controllers.Events;

import play.test.UnitTest;
public class markAttendance extends UnitTest {

	@Test
	public void getAssignedUser()
	{
		User user1=new User("firstNameFirst","middleName","lastName","UserName","Password","email@email.com","0000000000","address","city","country","imageUrl").save();
		User user2=new User("firstNameSecond","middleName","lastName","UserName","Password","email@email.com","0000000000","address","city","country","imageUrl").save();
		User user3=new User("firstNameThird","middleName","lastName","UserName","Password","email@email.com","0000000000","address","city","country","imageUrl").save();
		Event event=new Event().save();
		EventUser eu1=new EventUser(user1, event).save();
		EventUser eu2=new EventUser(user2, event).save();
		EventUser eu3=new EventUser(user3, event).save();
		eu1.attendance=true;
		List<User> att=new ArrayList<User>();
		List<User> abs=new ArrayList<User>();
		att.add(user1);
		abs.add(user2);
		abs.add(user3);
		eu1.save();
		List<List<User>> users=Events.getAssignedUsers(event);
		assertEquals(att,users.get(0));
		assertEquals(abs,users.get(1));
	}
}
